﻿package main

import "fmt"

func sum(a int, arg ...int) (res int) {
    res = a
    for i := 0; i < len(arg); i++ {
        res += arg[i]
    }
    return
}

func main() {
    var res int
    res = sum(1)
    fmt.Println(res)
    res = sum(1, 2)
    fmt.Println(res)
    res = sum(1, 2, 3)
    fmt.Println(res)
}